package com.wanxi.service.impl;

import com.wanxi.feign.NewsFeignClient;
import com.wanxi.model.NewsQuery;
import com.wanxi.result.CommonResult;
import com.wanxi.service.FrontNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FrontNewsServiceImpl implements FrontNewsService {

    @Autowired
    private NewsFeignClient newsFeignClient;

    @Override
    public CommonResult findNews(NewsQuery newsQuery) {
        CommonResult commonResult = newsFeignClient.findNews(newsQuery);
        if (commonResult.getCode() == 200){
            return commonResult;
        }else {
            return CommonResult.failed();
        }
    }
}
